home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 19
/
019.d81
/
t.pps #43
< prev
next >
Wrap
Text File
|
2022-08-26
|
2KB
|
132 lines
======================================
PEEKs, POKEs, and SYSes, Part 43
by Jim Weiler
======================================
Now, what nit-picking details do we
have to learn to make waveform, pulse
rate and volume behave? Very few,
actually. Since all voices work the
same, we'll only look at voice one.
----------
WAVEFORM:
As you already know, there are just
four waveforms for you to choose
from. Each has a numeric value, as
outlined below:
wave on wave off
======= ========
TRIANGLE 17 16
SAWTOOTH 33 32
PULSE 65 64
NOISE 129 128
To turn a voice on, poke the wave
on value into SID+4. As soon as you
do so, the voice will start playing
the waveform you selected. The
volume envelope will proceed
through the attack, decay and sustain
portions. Then, to turn the voice
off, poke the wave off value into
SID+4. At that point, the release
portion of the envelope will be
activated.
Here's a graphic representation of
what happens when you play a note:
<-A-><D><--S----><-R->
.
. .
. ...........
. .
. ^ .
. ! .
^ ! .
wave on wave off
POKE S+4,33 POKE S+4,32
----------
PULSE RATE:
As I said before, pulse rate is
only meaningful for a pulse waveform.
Pulse rate can be set from 0 to 4095.
A pulse rate of 2048 will produce a
perfect square wave (on half of the
time, off half of the time).
You store the pulse rate as a
byte-and-a-half number in S+2 and
S+3. The low byte goes in S+2, and
the high half-byte goes in S+3.
It goes something like this in
BASIC:
PU=2012
PH=INT(PU/256)
PL=PU-PH*256
POKE S+2, PL
POKE S+3, PEEK S+3 AND 240 OR PH
----------
VOLUME:
Nothing could be simpler than
volume:
POKE S+24,VOL
Volume must have a value from 0 to 15.
----------
That about covers the simpler
aspects of waveforms and voices.
Next month we'll cover pitch, and
then we'll be ready to make beautiful
music together with our C-64's.
----------<end of article>---------